let obj = {
    [Symbol.iterator]: () => {}
}

function createIterator(array) {
    let index = 0;
    return {
        next: function () {
            return {value: array[index++], done: index <= array.length ? false : true };
        },
    }
}

const myIterator = createIterator([1, 2, 3])
console.log(myIterator.next())
console.log(myIterator.next())
console.log(myIterator.next())
console.log(myIterator.next())